//
//  MainTableViewCell.m
//  云律司
//
//  Created by 韦淋 on 2017/6/22.
//  Copyright © 2017年 test. All rights reserved.
//

#import "MainTableViewCell.h"

@implementation MainTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initalizeInterface];
    }
    return self;
}
- (void)initalizeInterface{
    [self.contentView addSubview:self.lineView];
    [self.contentView addSubview:self.titleLable];
    [self.contentView addSubview:self.contenLable];
    [self.contentView addSubview:self.publisherLable];
    [self.contentView addSubview:self.msgTypeLable];
    [self.contentView addSubview:self.checkLable];
    [self.contentView addSubview:self.dateView];
    [self.dateView addSubview:self.dTimeLable];
    [self.dateView addSubview:self.mYTimeLable];
    
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.bgView.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.height );
    self.lineView.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, 10);
    self.dateView.frame = CGRectMake(20, 30, 80, 80);
    self.titleLable.frame = CGRectMake(120, 20, 250, 30);
    self.contenLable.frame = CGRectMake(120, 50, 250, 20);
    self.msgTypeLable.frame = CGRectMake(120, 70, 250, 20);
    self.publisherLable.frame = CGRectMake(120, 90, 250, 20);
    self.checkLable.frame = CGRectMake(0, 120, self.contentView.bounds.size.width, 30);
    self.dTimeLable.frame = CGRectMake(0, 0, 80, 40);
    self.mYTimeLable.frame = CGRectMake(0, 40, 80, 40);
}

- (UIView *)bgView{
    if (!_bgView) {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = [UIColor colorWithRed:248.0f/255.0f green:248.0f/255.0f blue:248.0f/255.0f alpha:1.0f];
    }
    return _bgView;
}
- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor colorWithRed:238.0f/255.0f green:238.0f/255.0f blue:238.0f/255.0f alpha:1.0f];
    }
    return _lineView;
}
- (UIView *)dateView{
    if (!_dateView) {
        _dateView = [[UIView alloc] init];
        _dateView.backgroundColor = [UIColor clearColor];
        _dateView.layer.masksToBounds = YES;
        _dateView.layer.cornerRadius = 5;
        _dateView.layer.borderWidth = 1;
        _dateView.layer.borderColor = [[UIColor colorWithRed:238.0f/255.0f green:238.0f/255.0f blue:238.0f/255.0f alpha:1.0f] CGColor];
    }
    return _dateView;
}
- (UILabel *)dTimeLable{
    if (!_dTimeLable) {
        _dTimeLable = [[UILabel alloc] init];
        _dTimeLable.textColor = [UIColor colorWithRed:33.0f/255.0f green:180.0f/255.0f blue:237.0f/255.0f alpha:1.0f];
        _dTimeLable.font = [UIFont systemFontOfSize:25];
        _dTimeLable.textAlignment = NSTextAlignmentCenter;
    }
    return _dTimeLable;
}
- (UILabel *)mYTimeLable{
    if (!_mYTimeLable) {
        _mYTimeLable = [[UILabel alloc] init];
        _mYTimeLable.textColor = [UIColor whiteColor];
        _mYTimeLable.backgroundColor = [UIColor colorWithRed:33.0f/255.0f green:180.0f/255.0f blue:237.0f/255.0f alpha:1.0f];
        _mYTimeLable.font = [UIFont systemFontOfSize:15];
        _mYTimeLable.textAlignment = NSTextAlignmentCenter;
    }
    return _mYTimeLable;
}
- (UILabel *)titleLable{
    if (!_titleLable) {
        _titleLable = [[UILabel alloc]init];
        _titleLable.textColor = [UIColor blackColor];
        _titleLable.font = [UIFont systemFontOfSize:15];
    }
    return _titleLable;
}
- (UILabel *)contenLable{
    if (!_contenLable) {
        _contenLable = [[UILabel alloc]init];
        _contenLable.textColor = [UIColor lightGrayColor];
        _contenLable.font = [UIFont systemFontOfSize:13];
        _contenLable.numberOfLines = 2;
        _contenLable.lineBreakMode = NSLineBreakByTruncatingTail;
    }
    return _contenLable;
}
- (UILabel *)msgTypeLable{
    if (!_msgTypeLable) {
        _msgTypeLable = [[UILabel alloc]init];
        _msgTypeLable.textColor = [UIColor lightGrayColor];
        _msgTypeLable.font = [UIFont systemFontOfSize:11];
        _msgTypeLable.numberOfLines = 2;
        _msgTypeLable.lineBreakMode = NSLineBreakByTruncatingTail;
    }
    return _msgTypeLable;
}
- (UILabel *)publisherLable{
    if (!_publisherLable) {
        _publisherLable = [[UILabel alloc]init];
        _publisherLable.textColor = [UIColor lightGrayColor];
        _publisherLable.font = [UIFont systemFontOfSize:11];
        _publisherLable.numberOfLines = 2;
        _publisherLable.lineBreakMode = NSLineBreakByTruncatingTail;
    }
    return _publisherLable;
}

- (UILabel *)checkLable{
    if (!_checkLable) {
        _checkLable = [[UILabel alloc]init];
        _checkLable.backgroundColor = [UIColor colorWithRed:249.0f/255.0f green:249.0f/255.0f blue:249.0f/255.0f alpha:1.0f];
        _checkLable.textColor = [UIColor lightGrayColor];
        _checkLable.text = @"查看更多";
        _checkLable.textAlignment = NSTextAlignmentCenter;
        _checkLable.font = [UIFont systemFontOfSize:12];
    }
    return _checkLable;
}

@end
